package com.zry.study.ui.base;

import android.app.Activity;
import android.app.Dialog;
import android.content.pm.ActivityInfo;
import android.os.Bundle;

import com.zry.study.config.MyActivityManager;
import com.zry.study.config.MyApplication;
import com.zry.study.utils.ToastUtil;



/**
 * Created by 19428 on 2017/6/4.
 */

public abstract class BaseNativeActivity extends Activity {
    public MyApplication myApplication;
    public MyActivityManager myActivityManager;
    public Dialog loadingDialog;



    @Override
    protected void onCreate( Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        myActivityManager=MyActivityManager.Companion.getActivityManager();
        myActivityManager.addActivity(this);
        myActivityManager.addPermissionActivity(this);
        myApplication = MyApplication.Companion.getInstance();
        loadingDialog = ToastUtil.Companion.loadingDialog(this);
        //禁止横竖屏切换
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);


    }



    protected void toast(String toastMessage) {
        ToastUtil.Companion.toast(this, toastMessage);
    }

    @Override
    protected void onDestroy() {

        myActivityManager.removePermissionActivity(this);
        myActivityManager.finishActivity();
        super.onDestroy();
    }
}
